/*
Autor: Alexander Savochkin, 2010
New BSD License
*/

#pragma once
#include <string>

#include "IOperatedInput.h"
#include "IOperatedOutput.h"

#include "Config.h"

using std::string;

using SRCLF::Config::Configuration;

namespace SRCLF
{
namespace IO 
{
	class FakeInput : public IOperatedInput
	{
		double value;
	public:
		FakeInput(const string& name, const Configuration& config) {};
		virtual ~FakeInput() {};
		//
		virtual bool open() {};
		virtual double getInput() { return value; }

		virtual void adminCommand(const string& command, string& result);

		//"fake" input understands one "control" command: "set $value", where 
		//$value - new value of input
		virtual void controlCommand(const string& command, string& result);
		virtual void infoCommand(string& command, string& result);

		virtual void close() {};
	};

	class FakeOutput : public IOperatedOutput
	{
		double value;
	public:
		FakeOutput(const string& name, const Configuration& config) {};
		virtual ~FakeOutput();
		//
		virtual bool open() {};
		virtual void close() {};

		virtual void setOutput(double _value) { value = _value; }
		virtual double getOutput() { return value; }

		virtual void adminCommand(const string& command, string& result);
		virtual void controlCommand(const string& command, string& result);
		virtual void infoCommand(string& command, string& result);
	};
} //namespace IO
} //namespace SRCLF
